package {
	import de.wellenblau.PaperBase.PaperBaseFixed;
	import de.wellenblau.textTracer.textTracer;
	import de.wellenblau.wow3D.physicCube3D;
	import de.wellenblau.wow3D.physicPapervision;
	import de.wellenblau.wow3D.physicSphere3D;
	
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.materials.utils.MaterialsList;

	[SWF(width="800", height="600", backgroundColor="0x000000", frameRate="30")]
	public class wow3D extends PaperBaseFixed
	{
		private var physic3D:physicPapervision;
		
		public function wow3D()
		{
			init();
		}
		
		override protected function init3d():void{
			physic3D=new physicPapervision(default_scene);
			
			default_camera.moveUp(300);
			default_camera.moveBackward(50);
			
			//Ground
			physic3D.createGround();
			
			//create Material
			var tmpMatList:MaterialsList = new MaterialsList();
			var tmpMat:WireframeMaterial = new WireframeMaterial(0x00ff00);
			tmpMatList.addMaterial(tmpMat,"all");
			
			//Cubes and Spheres
			for(var i:int = 0; i < 10; i++){
				
				//Random Positions
				var x:int = Math.random()*50-25;
				var y:int = 600+(i*120);
				var z:int = Math.random()*50-25;
				
				if(i%2 == 0){
					//Cube
					physic3D.add(new physicCube3D(x,y,z,40,tmpMatList));
				}
				else{
					//Sphere
					physic3D.add(new physicSphere3D(x,y,z,40,tmpMat));
				}
			}
		}
		
		override protected function processFrame():void{
			physic3D.update();
		}
	}
}
